<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="ls" uri="/ls-trade-tags"%>
<%@ include file="/common/taglibs.jsp"%>


<html>
<head>
	<title>选择产品</title>
	<%@ include file="/common/meta.jsp" %>
	<%@ include file="/common/css_js.jsp"%>	
	
	<script type="text/javascript">
	
		function clickBtn(action,id,e){
			
			switch(action){
			case "search":
				$("#mainForm").attr("action","order-template-item!searchProducts.action?no-decorate");
				break;	
				
			case "confirmSelectedProducts":
				$("#mainForm").attr("target","orderTemplateItemIframe");
				$("#mainForm").attr("action","order-template-item!confirmSelectedProducts.action?no-decorate");
				$("#mainForm").submit();
				
				$(".aniBox",window.parent.document).remove();
				$(".winMask",window.parent.document).remove();
				$(".popup",window.parent.document).remove();
				
				return;	
			
			case "close":
				$(".aniBox",window.parent.document).remove();
				$(".winMask",window.parent.document).remove();
				$(".popup",window.parent.document).remove();

				return;
				
			case "save":
				$("#mainForm").attr("action","monitor-transmission!save.action");
				break;	
			}
			
			$("#mainForm").submit();
		}	

	</script>
</head>

<body>
  <s:form id="mainForm" name="mainForm" action="order-template-item!searchProducts.action" method="post">
	<s:hidden name="orderTemplateId" id="orderTemplateId"></s:hidden>
	
  	<div class="form1">
    	<table border="0" cellspacing="0" cellpadding="0">
	      <tr>
	        <td class="sep" ><img src="../images/spacer.gif" style="width:180px;" /></td>
	        <td class="sep" ><img src="../images/spacer.gif" style="width:180px;" /></td>
	        <td class="sep" ><img src="../images/spacer.gif" style="width:180px;" /></td>
	        <td class="sep sep2" ><img src="../images/spacer.gif" /></td>
	      </tr>
	      <tr>
	        <td><label class="fLabel" >类型</label>
	          <div class="fField">
	            <s:textfield name="product.type" cssStyle="width:150px" cssClass="inputText"/>
	          </div></td>
	        <td><label class="fLabel">代码</label>
	          <div class="fField">
	          	<s:textfield name="product.code" cssStyle="width:150px" cssClass="inputText"/>
	          </div></td>
	        <td><label class="fLabel" >名称</label>
	          <div class="fField">
	          	<s:textfield name="product.name" cssStyle="width:150px" cssClass="inputText"/>
	          </div></td>
	          <td>&nbsp;</td>
	      </tr>
     
        </table>
          
	    <div class="btnSet btnSetTypeB">
		      <div class="left" >
		      
		        <div class="button" >
		          <div class="left" >
		            <div class="right" >
		              <input class="inputButton" type="button" id="searchBtn" name="search" value="<s:text name="common.btn.search"/>" onclick="clickBtn('search');"/>
		            </div>
		          </div>
		        </div>
		        
		        <div class="button" >
		          <div class="left" >
		            <div class="right" >
		              <input class="inputButton" type="button" id="clearBtn" name="clear" value="<s:text name="common.btn.view.all"/>" onclick="clickBtn('clear');"/>
		            </div>
		          </div>
		        </div>

		        <div class="button" >
		          <div class="left" >
		            <div class="right" >
		              <input class="inputButton" type="button" id="clearBtn" name="clear" value="确定选择" onclick="clickBtn('confirmSelectedProducts','',event);"/>
		            </div>
		          </div>
		        </div>	
		        
		        <div class="button" >
		          <div class="left" >
		            <div class="right" >
		              <input class="inputButton" type="button" id="clearBtn" name="clear" value="关闭" onclick="clickBtn('close','',event);"/>
		            </div>
		          </div>
		        </div>		        
	      </div>
      	</div>
    
	</div>    
    
	<s:if test="%{page!=null&&page.result!=null&&page.result.size()!=0}">
	<div class="sListBorder">
	   <div class="sList">
	     <table width="100%" cellspacing="0" cellpadding="0" border="0" class="sTable">
	       <tbody>
	       <tr>
			 <td class="sTh checkbox"><input type="checkbox" name=""
				 id="controlCheckbox" class="inputCheckbox"
				 onclick="clickParent('controlCheckbox','ids')" />
			 </td>	       
	         <td style="width: 70px;" class="sTh t"> 类型</td>
	         <td class="sTh t">代码</td>
	         <td class="sTh t">产品名</td>
	         <td class="sTh t">默认单价</td>
	         <td class="sTh t">单位</td>
	       </tr>
	       
	       <s:iterator value="page.result" var="product" status="st">
	       
	      	  <s:set var="trClass" value="'sRow1'"></s:set>
	    	  <s:if test="#st.index%2==0">
	       	 		<s:set var="trClass" value="'sRow2'"></s:set>
		       	 <s:else>
		       	    <s:set var="trClass" value="'sRow1'"></s:set>
		       	 </s:else>
			  </s:if>
			  
		      <tr class="<s:property value='#trClass'/>">
				 <td class="sCell">
					<input type="checkbox" name="ids" value="<s:property value='#product.id'/>" 
					       onclick="clickChild('controlCheckbox','ids')" class="inputCheckbox" />
			     </td>		      
		         <td class="sCell"><ls:code2label type="PRODUCT_TYPE" code="#product.type"/></td>    
		         <td class="sCell"><s:property value="#product.code"/></td>
		         
	         	<td class="sCell">
		         	<a href="#" onclick="clickBtn('edit','<s:property value='#product.id'/>',event)">
		         		<s:property value="#product.name"/>
		         	</a>
	         	</td>
		         
		         <td class="sCell"><s:property value="#product.defaultPrice"/></td>
		         <td class="sCell"><s:property value="#product.unit"/></td>
	      	 </tr>		       
	       </s:iterator>
	     </tbody>
	     </table>
	   </div>
	   
	   <ls:paging page="%{page}"></ls:paging>
	 </div>
	</s:if> 

  </s:form>
  
</body>
</html>